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