UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'yANeqwj5euscQsHoZJxLiRtLYLxUqXp4o+GIe3sbErw='
WHERE
key_id = '4eaeee9ff025398c9d916a22b4977721802b3d1de96a7caded798be5e0998cec'
AND (
token = 'yANeqwj5euscQsHoZJxLiRtLYLxUqXp4o+GIe3sbErw='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)