UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'XKCKOrG2LXGLPqGrl9SiE8meQnShhWjlXJJm+eT7nWA='
WHERE
key_id = '1f055e2aacd35db26b8e555cbbe614919b9a9f75df0a1787d72125150ca428e7'
AND (
token = 'XKCKOrG2LXGLPqGrl9SiE8meQnShhWjlXJJm+eT7nWA='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)