UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'NgcmZvhzvDsdSCpCbGSr7YbmMaqxj2Ni/DMl0DYaKCg=' 
WHERE 
  key_id = '166a3442e8d5ff513c63410878958012b1d50f459ba095331bdef5aa73e1ecfe' 
  AND (
    token = 'NgcmZvhzvDsdSCpCbGSr7YbmMaqxj2Ni/DMl0DYaKCg=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00029