UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'abQWQlFsAQ71Wx3xlzTgLESdIVUAkQHizh35PG7vggo='
WHERE
key_id = '9d93dd3de05bfebe0fc6785b70c4724fbdf45182ef4e7e6891f894c47f76987c'
AND (
token = 'abQWQlFsAQ71Wx3xlzTgLESdIVUAkQHizh35PG7vggo='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)