UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'Um2sqEGK+SgtFtDuTTe9eLbrjbn86Eap9zdd8P/6WAg='
WHERE
key_id = 'cea01179911e7fe9f3a8e6956a6886ff725868b36c1ba842f9caf724b8d72dee'
AND (
token = 'Um2sqEGK+SgtFtDuTTe9eLbrjbn86Eap9zdd8P/6WAg='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)