UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'XLDl6Bnw1dnbjI6MVesj9lrcnKZzmO6zFQGV03+spog='
WHERE
key_id = 'f21cac1e2ef82bf83a9ea91cd237d570af0f6017c93c92756b0658a5f46715ee'
AND (
token = 'XLDl6Bnw1dnbjI6MVesj9lrcnKZzmO6zFQGV03+spog='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)