UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'tCittZs6e1Ai8E286ZIU7CWj0r5ZJYb7GUUIszNwut8='
WHERE
key_id = '85c0ab13ae8864a347acac7ecf23589ba7150d31efc0218c84af3202ee5335c8'
AND (
token = 'tCittZs6e1Ai8E286ZIU7CWj0r5ZJYb7GUUIszNwut8='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)