UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'RuUMd90gqlGo5bY1E1xCPzjaTtr2OQhs9PVRMWNPWe4='
WHERE
key_id = 'f17acde1df15454e18b480e8f8a3f3f58401d964746da36101dd76e5ad66f9a8'
AND (
token = 'RuUMd90gqlGo5bY1E1xCPzjaTtr2OQhs9PVRMWNPWe4='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)