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

Query time 0.00022