UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'up8XZhj0g8WZUNNkK86YJ6V3goK+iA3Dni8YXZ6+qho=' 
WHERE 
  key_id = 'cc7a7133fd43b9deb331999f04d2d55e8bb2457eb9e9dcc1d2400825c9eaae57' 
  AND (
    token = 'up8XZhj0g8WZUNNkK86YJ6V3goK+iA3Dni8YXZ6+qho=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00069