UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'AQNC2FIEY5iTHH/Q4fTWXzQA1ZGSTysfbvO0u2VKLYw='
WHERE
key_id = '02bce4e1bdb68b19e632b641e562bd79a82b348f2d951542a545d4e49462013b'
AND (
token = 'AQNC2FIEY5iTHH/Q4fTWXzQA1ZGSTysfbvO0u2VKLYw='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)