UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'AvlFKzgHxr2Bse3DXxfyy28mqTeu/yDhEuWitknSFNA='
WHERE
key_id = 'ccc69eea9baf7492b532061b464d1dcae13321df3364a19eb8e0c1888468874b'
AND (
token = 'AvlFKzgHxr2Bse3DXxfyy28mqTeu/yDhEuWitknSFNA='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)