UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'pQzQpxKrebMMKZvWFn8HPGkuWSE0uokoIt1MPmyxDa8='
WHERE
key_id = '3c9a8994c3eab9e21245c112794ae5eb70b604ecbfedfbe404bf98e18cf6f50a'
AND (
token = 'pQzQpxKrebMMKZvWFn8HPGkuWSE0uokoIt1MPmyxDa8='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)