UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'ND2hNTWUkCrwwNd6v3n7qfntRe1Bmokocz1sRltlz0s=' 
WHERE 
  key_id = '42bdc37789d9d1389f48715191caaf127ed3c840be507b0a87db4578799337ef' 
  AND (
    token = 'ND2hNTWUkCrwwNd6v3n7qfntRe1Bmokocz1sRltlz0s=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00028