UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'aDqPClZws/ClqoqJ3za0uWtzq/wbBZmYZAtvrf0cYIw='
WHERE
key_id = '52da4afa87349155541cfbd2a58d521d28b84c0dc25236588497b4cd689a4947'
AND (
token = 'aDqPClZws/ClqoqJ3za0uWtzq/wbBZmYZAtvrf0cYIw='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)