UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = '6saN/EgBMuhbdBRQlcL+fWkXARomUh6662TPOPl/7vA=' 
WHERE 
  key_id = 'd3550be76b164758059b0b465516f4795d961be6f42575b46ff6a381964bec3a' 
  AND (
    token = '6saN/EgBMuhbdBRQlcL+fWkXARomUh6662TPOPl/7vA=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00035