UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'UVG8vmBqoZjMmLIivutyd5kGdm6QTw2+MTdD7RCFvk8='
WHERE
key_id = 'bac53f4e609e21e13739ec65216f7eec198eed4608baa25648e1a58b1463d8b8'
AND (
token = 'UVG8vmBqoZjMmLIivutyd5kGdm6QTw2+MTdD7RCFvk8='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)