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

Query time 0.00029