UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'MRwvVIUymZLZ79iOLMjYL5QBJctE5ZqUh1OzQLFxKbI='
WHERE
key_id = 'ee80e73c3270678b528aa3159582344134d7d2ed24e97f05f028e03736ec43d5'
AND (
token = 'MRwvVIUymZLZ79iOLMjYL5QBJctE5ZqUh1OzQLFxKbI='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)