UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'GtNcztkRMzY8qWqWhCsdKjX0R8B/WGUUF229A1a406g='
WHERE
key_id = '01fe9e6fabb0d4e953ce8d0858f3f7045f38bd429f0a23053d5616e05dbe47bf'
AND (
token = 'GtNcztkRMzY8qWqWhCsdKjX0R8B/WGUUF229A1a406g='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)