UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = '7g2UjEngDoa1zpcHZQaZkdaiYAfC7iALV1FjOEec41Y=' 
WHERE 
  key_id = '9128ab8ccaa7976ffa2add3c0600a6130a4e767c46d88cf0589f76c7b6b12822' 
  AND (
    token = '7g2UjEngDoa1zpcHZQaZkdaiYAfC7iALV1FjOEec41Y=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00051