UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'zZzwb5ufjxMSu4SIJeTF78dsDODaMKRlmyeTooaL+bs='
WHERE
key_id = 'f0687b3226b02cf768c41656267617877a09f245b565f9563b4f0e9868d9d532'
AND (
token = 'zZzwb5ufjxMSu4SIJeTF78dsDODaMKRlmyeTooaL+bs='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)