UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'vN77S7+J/JVlxfulPz/s4ZjOPujQe8bBP1rH9ujbl98='
WHERE
key_id = '0e7dab5ec21e643ab3a9651c20179f548514c3b32f5dec93d8c9d992eaedba87'
AND (
token = 'vN77S7+J/JVlxfulPz/s4ZjOPujQe8bBP1rH9ujbl98='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)