UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'WaT8+yRnbWjUfyvOhMGE4makuxEKz4ChAF6je3gznVc=' 
WHERE 
  key_id = 'f51935c74e025c2db001db0b231ed29d410e2adc4a424214dacf68f4f09120e2' 
  AND (
    token = 'WaT8+yRnbWjUfyvOhMGE4makuxEKz4ChAF6je3gznVc=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00040