UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'SJU5PUNqK3qhErCTYs0aCPx5w4wuZP/e7T991rG6iQE='
WHERE
key_id = 'a2563389151740af2307de18fe08eb572d1473d23095906422978b7874320448'
AND (
token = 'SJU5PUNqK3qhErCTYs0aCPx5w4wuZP/e7T991rG6iQE='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)