UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = '6Qafv9E7fmRKj14JMZBA8d3/RqUmvIrAxijqJ4ANU0A='
WHERE
key_id = 'e1052c2ae50fda6f661a6509340b507ae74e4d11b6fd22e96b39d4c364ce8f9c'
AND (
token = '6Qafv9E7fmRKj14JMZBA8d3/RqUmvIrAxijqJ4ANU0A='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)