UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'nFcz7XfJXR63eI5O4OC4Q8ztTOjjzvDED+JwGp+Kc54='
WHERE
key_id = 'c8b377c8be13dc00fecf819e403b4edc873cefcea5aeb86fbe79fd4d5f8c6d15'
AND (
token = 'nFcz7XfJXR63eI5O4OC4Q8ztTOjjzvDED+JwGp+Kc54='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)