UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'HlyHTY+le6fy5lWS4EbPEBn7I0ERJIwmARWAUE2sjVk='
WHERE
key_id = 'eab09e6f8e82c7c6b31c1a05c809d785878eccf99b771958a6a74127f9b23ccb'
AND (
token = 'HlyHTY+le6fy5lWS4EbPEBn7I0ERJIwmARWAUE2sjVk='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)