UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = '3jb3nSh0KI35qTzAVF4Q4U3WnEQYNQTCNWboWXsr/gs='
WHERE
key_id = 'c168d0f4ab234fc8a92823aec8f7920a65faa98d6bcccc5c86d761009ed3b7a0'
AND (
token = '3jb3nSh0KI35qTzAVF4Q4U3WnEQYNQTCNWboWXsr/gs='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)