UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'frXzxKhwQMl4XLM5PpPljehaPlykmwvtY1LNuXtLdPA=' 
WHERE 
  key_id = '7821db37a02c614e88fe482dc81ba7f2af4170b973e149bc1f7617749f175dad' 
  AND (
    token = 'frXzxKhwQMl4XLM5PpPljehaPlykmwvtY1LNuXtLdPA=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00052