UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'Wl4BP7ZdkbU6deX4Kd86sl+2noo38VFcjSPkTkPExkQ=' 
WHERE 
  key_id = 'f24a16c09d1c29ae630f7d9a63f1e133110af0d194dee44cc9a68c0fd587aa13' 
  AND (
    token = 'Wl4BP7ZdkbU6deX4Kd86sl+2noo38VFcjSPkTkPExkQ=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00032